package com.sihan.framework.etm.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class PermissionVO implements Serializable {

  private static final long serialVersionUID = 8825168359582703868L;

  @ApiModelProperty(value = "权限Id")
  private String id;

  @ApiModelProperty(value = "是否可用：0 不可用；1可用")
  private Short available;

  @ApiModelProperty(value = "权限父Id")
  private String parentId;

  @ApiModelProperty(value = "权限名称")
  private String text;

  @ApiModelProperty(value = "权限标识")
  private String identify;

  @ApiModelProperty(value = "资源类型")
  private String resourceType;

  @ApiModelProperty(value = "图表（菜单专用）")
  private String icon;

  @ApiModelProperty(value = "菜单url")
  private String url;

  @ApiModelProperty(value = "静态文件url")
  private String fileUrl;

  @ApiModelProperty(value = "排序号")
  private Integer sort;

  @ApiModelProperty(value = "创建时间")
  private Date createTime;

  @ApiModelProperty(value = "子权限")
  private List<PermissionVO> children;

  public PermissionVO(String id) {
    this.id = id;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    PermissionVO that = (PermissionVO) o;
    return Objects.equals(id, that.id);
  }

  @Override
  public int hashCode() {

    return Objects.hash(id);
  }
}
